package com.ywjt.platformbusiness.classify.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.store.model.StoreGoodsListModel;

import java.util.List;

public class ShopHomeGoodsAdapter extends BaseQuickAdapter<StoreGoodsListModel.ResultDTO.RecordsDTO, BaseViewHolder> {

    public ShopHomeGoodsAdapter(@Nullable List<StoreGoodsListModel.ResultDTO.RecordsDTO> data) {
        super(R.layout.item_goods_type_fragment, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, StoreGoodsListModel.ResultDTO.RecordsDTO item) {
        ImageView ivGoodsImg=helper.getView(R.id.ivGoodsImg);
        Glide.with(mContext).load(item.getMainPhoto())
                .placeholder(R.mipmap.default_image)
                .into(ivGoodsImg);
        helper.setText(R.id.tvGoodPrice,"¥"+item.getPrice());
        helper.setText(R.id.tvGoodName,item.getName());
        helper.setText(R.id.tvBuyerNum,item.getStatus()+"人已购买");
    }
}
